﻿using System.Collections.Generic;

namespace Red.Toolkit.Profiler.Logic
{
    /// <summary>
    /// Set of events triggered in a common group (e.g. thread)
    /// </summary>
    public class Group
    {
        private bool _visible;
        protected string _name;
        private List<Event> _events;

        // if set to true it means that a event can end only when all child events has ended
        private bool _stackStructure;

        public Group( string name, bool stackStructure )
        {
            _visible = true;
            _name = name;
            _stackStructure = stackStructure;
            _events = new List<Event>();
        }

        public void AddEvent( Event e )
        {
            _events.Add( e );
        }

        public string Name { get { return _name; } }
        public bool Visible
        {
            get { return _visible; }
            set { _visible = value; }
        }
   
        public List<Event> Events { get { return _events; } }
        public bool StackStructure { get { return _stackStructure; } }
        public string DetailsString { get { return _events.Count + " events"; } }
    }
}
